package com.sram.action;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

import org.apache.commons.io.FileUtils;
import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;
import com.sram.entity.User;

public class UserDownAction extends ActionSupport{
	private String fileName;
	
	public String getFileName() {
		return fileName;
	}
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	public InputStream getA(){
		FileInputStream fis = null;
		try {
			String path = ServletActionContext.getServletContext().getRealPath("/img/"+fileName);
			fis = new FileInputStream(path);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		return fis;
	}
	//文件下载
	public String execute(){
		
		    return SUCCESS;
	}
}
